package com.cy.cy2025

import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.compositionLocalOf
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp


val CL1 = compositionLocalOf<Int> { 0 }

@Preview(showBackground = true)

@Composable
fun ComposeTest1(){
    val a = remember {
        mutableIntStateOf(1)
    }
    CompositionLocalProvider(CL1 provides a.intValue){
        Column (modifier = Modifier.padding(top = 100.dp)){
            Text(text = "${CL1.current}", modifier = Modifier.clickable {
                a.intValue ++
            })

            ComposeTest2()
        }

    }

}

@Composable
fun ComposeTest2(){
    Column {
        Text(text = "${CL1.current}")
        ComposeTest3()
    }
}

@Composable
fun ComposeTest3(){
    Text(text = "${CL1.current}")
}